'use strict';

module.exports = app => {
  const { INTEGER, DATE } = app.Sequelize;

  const UserGroupMember = app.model.define('user_group_member', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    userId: {
      type: INTEGER,
      allowNull: false,
      field: 'user_id'
    },
    groupId: {
      type: INTEGER,
      allowNull: false,
      field: 'group_id'
    },
    createdAt: {
      type: DATE,
      field: 'created_at'
    },
    updatedAt: {
      type: DATE,
      field: 'updated_at'
    }
  }, {
    tableName: 'user_group_members',
    timestamps: true
  });

  return UserGroupMember;
};